#-*- coding:utf8 -*-
#!/usr/bin/python
'''
author: lixinpan
createTime: 2021-06-24 16:14
update: lixinpan
updateTime: 2021-06-24 16:14
description: 文件简介描述
'''
class ProductInfo:
    def __init__(self):
        self.product_name = None
        self.id = None
        self.price = None
        self.manufacturer = None

class ProductView:
    def print_product(self,product):
        # product = ProductInfo() # 耦合点

        print(f"Name:{product.product_name}")
        print(f"Price:{product.price}")
        print(f"Manufcturer:{product.manufacturer}")

class ProductController:
    '''
    控制器，控制用户的输入，选择合适的view输出
    '''
    def __init__(self,product,view):
        self.product = product
        self.product_view = view

    def refresh_view(self):
        pass
        self.product_view.print_product(self.product)

    def update_model(self,product_name,price,manufacturer):
        self.product.product_name = product_name
        self.product.price = price
        self.product.manufacturer = manufacturer

# 实际执行代码
controller = ProductController(ProductInfo(),ProductView())
controller.refresh_view()
controller.update_model("new_name",15,"ABC")

